const webpack = require('webpack')
const merge = require('webpack-merge');
const common = require('./webpack.common.js');

module.exports = merge(common, {
  entry: './src/index.js',
  devtool: 'source-map',
  externals: {
    'vue': 'vue',
    'vue-router': 'VueRouter',
    'vuex': 'Vuex',
    'axios': 'axios',
    'js-cookie':'js-cookie',
    'element-ui':'element-ui'
  },
  resolve: {
    alias: {
      'vue$': 'vue/dist/vue.esm.js'
    },
    extensions: ['*', '.js', '.vue', '.json']
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: '"production"'
      }
    }),
    new webpack.optimize.UglifyJsPlugin({
      sourceMap: false,
      compress: {
        warnings: false
      }
    }),
    //这个插件只支持webpack1~2 当前版本3.6 npm run build报错在这里
    // new webpack.LoaderOptionsPlugin({
    //   minimize: true
    // })
  ],
})
